﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Controls.Primitives;

namespace PopUpSample
{
	public partial class MainPage : PhoneApplicationPage
	{
		// Constructor
		public MainPage()
		{
			InitializeComponent();
		}

		private void Button_Click(object sender, RoutedEventArgs e)
		{
			Popup popup = new Popup();
			popup.Height = 300;
			popup.Width = 400;
			popup.VerticalOffset=100;
			PopUpUserControl control = new PopUpUserControl();
			popup.Child = control;
			popup.IsOpen = true;


			control.btnOK.Click += (s, args) =>
			{
				popup.IsOpen = false;
				this.text.Text = control.tbx.Text;
			};

			control.btnCancel.Click += (s, args) =>
			{
				popup.IsOpen = false;
			};
		}
	}
}